package com.atom.app;

import android.content.Context;

import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.platform.app.InstrumentationRegistry;

import com.atom.annotation.api.ApiImplCallback;
import com.atom.annotation.api.ApiImplContext;
import com.atom.app.test.HelloWorld5;
import com.atom.base.app.Hello;
import com.atom.core.ApiImplRouter;
import com.atom.module.logger.Logger;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;

import java.util.Collection;

/**
 * Instrumented test, which will execute on an Android device.
 *
 * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
 */
@RunWith(AndroidJUnit4.class)
public class Test_ApiImpl_Impl_Provider {

    @Before
    public void init(){
        // Context of the app under test.
        Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
        Logger.init(true, false, "");
    }

    @Test
    public void testApiImpl() {
        ApiImplRouter instance = ApiImplRouter.getInstance();
        instance.getImpl(Hello.class, "Hello5", new ApiImplCallback<Hello>() {
            @Override
            public void call(ApiImplContext apiImplContext, Hello hello) {
                Logger.e(hello.getClass() );
                if(HelloWorld5.class.isInstance(hello)){
                    hello.hello();
                }
            }
        });
    }
}